from flask import Flask
from db import db


def create_app():
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://root:root@127.0.0.1:3306/food-mate"
    db.init_app(app)

    # 注册蓝图
    from .ai_api import api
    from .user_info import user_api
    from .feedback import feedback_api

    app.register_blueprint(api)
    app.register_blueprint(user_api)
    app.register_blueprint(feedback_api)

    return app
